package com.xh.service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.system.comm.util.Snowflake;
import com.system.common.mapper.BisBusinessOrderMapper;
import com.system.common.mapper.BisCustomUserMapper;
import com.system.common.pojo.BisCustomUser;

@Service
public class BisCustomUserServiceImpl implements BisCustomUserService{
    @Autowired
    private BisCustomUserMapper bisCustomUserMapper;
    
    @Autowired
    private BisBusinessOrderMapper bisBusinessOrderMapper;
	@Override
	public List<Map<String,Object>> listAll(Map<String, Object> map) {
		List<Map<String, Object>> users=new ArrayList<>();
		List<Map<String, Object>> list=bisCustomUserMapper.listAll(map);
		for (Map<String, Object> user : list) {
			String del=(String)user.get("is_del");	
			if (del.equals("0")) {
				users.add(user);
			}
		}
	 	return users;
	}
	@Override
	public void addBisCustomUser(BisCustomUser user) {
		Snowflake sf=new Snowflake(0, 0);
		user.setCustomUserId(sf.nextId()+"");
		bisCustomUserMapper.insertSelective(user);
	}
	@Override
	public void delBisCustomUser(String customerUserId) {
		BisCustomUser user=bisCustomUserMapper.selectByPrimaryKey(customerUserId);
		user.setIsDel("1");
		bisCustomUserMapper.updateByPrimaryKey(user);
	}
	@Override
	public void updBisCustomUser(BisCustomUser user) {
		bisCustomUserMapper.updateByPrimaryKeySelective(user);
	}
	@Override
	public BisCustomUser getById(String customUserId) {
		return bisCustomUserMapper.selectByPrimaryKey(customUserId);
	}
	@Override
	public List<Map<String, Object>> listAll1(String customuserid) {
		return bisBusinessOrderMapper.listAll1(customuserid);
	}
    
}
